package com.sip.dbadapter.dao.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 */
@Entity
@Table(name = "SCENARIO_RECORD")
public class ScenarioRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long recordId;

    private String consumeValue;

    private Integer consumeType;

    private Date recordDate;
    
    private String result;
    
    private String executeMode;

    
    private ApiDefinition apiDefinitionScenarioRecord;
    
    
  	public ScenarioRecord() {

    }

    @Id
    @Column(name = "RECORD_ID", unique = true, nullable = false)
    @GeneratedValue
    public Long getRecordId() {

        return recordId;
    }
    
    @Lob @Basic(fetch = FetchType.LAZY)
    @Column(name = "RESULT")
    public String getResult() {
        return result;
    }
    @Column(name = "CONSUME_VALUE")
    public String getConsumeValue() {

        return consumeValue;
    }

    @Column(name = "CONSUME_TYPE")
    public Integer getConsumeType() {

        return consumeType;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "RECORD_DATE",columnDefinition="TIMESTAMP DEFAULT NOW()")
    public Date getRecordDate() {

        return recordDate;
    }
    
    @Column(name = "EXECUTE_MODE")
    public String getExecuteMode() {
        
        return executeMode;
    }
    

    @ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "API_ID", nullable = true)
    public ApiDefinition getApiDefinitionScenarioRecord() {
        return apiDefinitionScenarioRecord;
    }


    public void setApiDefinitionScenarioRecord(
            ApiDefinition apiDefinitionScenarioRecord) {
        this.apiDefinitionScenarioRecord = apiDefinitionScenarioRecord;
    }

    public void setRecordId(Long recordId) {

        this.recordId = recordId;
    }
    
    public void setResult(String result) {
        this.result = result;
    }

    public void setConsumeValue(String consumeValue) {

        this.consumeValue = consumeValue;
    }

    public void setConsumeType(Integer consumeType) {

        this.consumeType = consumeType;
    }

    public void setRecordDate(Date recordDate) {

        this.recordDate = recordDate;
    }
    
    public void setExecuteMode(String executeMode) {
        
        this.executeMode = executeMode;
    }
    

//    public void setApiDefinitionSet(Set<ApiDefinition> apiDefinitionSet) {
//
//        this.apiDefinitionSet = apiDefinitionSet;
//    }

//    public void setResultRecord(ResultRecord resultRecord) {
//
//        this.resultRecord = resultRecord;
//    }

    


    @Override
    public int hashCode() {

        int result = 0;
        result = (int) (31 * result + recordId);
        result = 31 * result + (consumeValue != null ? consumeValue.hashCode() : 0);
        result = 31 * result + (consumeType != null ? consumeType.hashCode() : 0);

        return result;
    }

    @Override
    public boolean equals(Object other) {

        if (this == other)
            return true;

        if (other == null || (this.getClass() != other.getClass())) {
            return false;
        }

        ScenarioRecord record = (ScenarioRecord) other;
        return (this.recordId == record.recordId) && (this.consumeValue != null && consumeValue.equals(record.consumeValue))
            && (this.consumeType != null && consumeType.equals(record.consumeType));
    }
    
    
    


	

}
